package org.fiebug.spring.boot.seata.account.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

@FeignClient(name="account", path = "/account", url = "localhost:8080")
public interface AccountFeign {
    /**
     * 出账
     */
    @RequestMapping(value = {"/credit"}, method = {RequestMethod.GET})
    ResponseEntity<String> credit(@RequestParam("id") Integer id, @RequestParam("amount") BigDecimal amount);

    /**
     * 入账
     */
    @RequestMapping(value = {"/debit"}, method = {RequestMethod.GET})
    ResponseEntity<String> debit(@RequestParam("id") Integer id, @RequestParam("amount") BigDecimal amount);

    /**
     * 转账
     */
    @RequestMapping(value = {"/transfer"}, method = {RequestMethod.GET})
    ResponseEntity<String> transfer(@RequestParam("creditId") Integer creditId, @RequestParam("debitId") Integer debitId, @RequestParam("amount") BigDecimal amount);
}
